home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 26
/
CU Amiga Magazine's Super CD-ROM 26 (1998)(EMAP Images)(GB)[!][issue 1998-09].iso
/
CUCD
/
Utilities
/
MARInA
/
Install-Guide
/
install.rexx
next >
Wrap
OS/2 REXX Batch file
|
1998-07-12
|
52KB
|
2,319 lines
/*
MARInA System © TNE) 1997/98
MARInA Installer Installation Script
for MARInA Base-Archive itself (=InstBase).
*/
OPTIONS RESULTS
CALL Init
/* -------------- BEGIN Definition Block ------------------ */
InstApp = "MARInA © 5'98 TNE)"
Author="©'98 Tom Neidhardt, 91058 Erlangen, GERMANY"
/* The Base Archive must have the same name for InstBase and InstModule */
InstBase='MARInA' /* do not use more than 12 characters here! */
InstModule='MARInA' /* do not use more than 12 characters here! */
/* Supply at least one Guide with the Name <InstBase>'.guide'
which has a Headline beginning with <InstBase>', ©' */
ObligedFile = RootPath'SYS/Choice_MARInA_bin/grep'
CALL CheckInstallDir
CALL CreateLogFile
/* ------------------------- */
ADDRESS COMMAND RootPath'SYS/Choice_MARInA_bin/SWindow >NIL: "'InstModule', ©#?" p p p s'
ADDRESS COMMAND RootPath'SYS/Choice_MARInA_bin/SWindow >NIL: "'InstModule', ©#?" b'
Msg="_Intro1"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN CALL ExitMe
Msg="_Intro2"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN CALL ExitMe
/* ------------------------- */
CALL RexxInstallInfo
CALL Create_UnInstallScript
/* ------------------------- */
ObligedFile = RootPath'SYS/Inst_Voice/deutsch/ok.8SVX'
CALL ExistsFile
/* ------------------------- */
Msg="h_direct_ENV"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN
CALL ExitMe
InstName = ' Direct ENV: & ENVARC: '
SourceDir = RootPath'SYS/Inst_ENV'
DestDir1 = 'ENVARC:'
DestDir2 = 'ENV:'
CALL CopyAction
/* ------------------------- */
InstName = ' SysVoice '
CALL InstallVoice
/* ------------------------- */
InstName = ' MARInA_rexx '
InstAssign = 'MARInA_rexx:'
InstSource = RootPath'SYS/Choice_MARInA'
InstDest1 = 'ENV:MARInA'
InstDest2 = 'ENVARC:MARInA'
MsgSrcDest = 'c1_MARInA_rexx_copy'
MsgOtherDir = 'c3_OtherRexxDir'
CALL Copy_SrcDest
MARInA_rexx = Selected_Dest
MARInA_rexx_Dir = Selected_Dest_Dir
/* ------------------------- */
InstName = ' MARInA_bin '
InstAssign = 'MARInA_bin:'
InstSource = RootPath'SYS/Choice_MARInA_bin'
InstDest1 = 'SYS:MARInA_bin'
MsgSrcDest = 'd1_MARInA_bin_copy'
MsgOtherDir = 'd3_OtherBinDir'
DoCheck = 1
CALL Copy_SrcDest
MARInA_bin = Selected_Dest
MARInA_bin_Dir = Selected_Dest_Dir
/* ------------------------- */
Msg="e_MARInA_bin_Infos"
Parameter1 = AppName
CALL ShowMessage
/* ------------------------- */
InstName = ' Libs & Catalogs & Prefs '
SourceDir=RootPath'SYS/Inst_SYS'
DestDir1='SYS:'
DoCheck = 1
CALL CopyAction
/* ------------------------- */
CALL CopyRefTable
ADDRESS COMMAND
'setenv RefTable/Dir-MARInA_Rexx 'MARInA_rexx_Dir
'setenv RefTable/Dir-MARInA_bin 'MARInA_bin_Dir
copy' ENV:RefTable/Dir-MARInA_REXX ENVARC:RefTable CLONE QUIET'
copy' ENV:RefTable/Dir-MARInA_bin ENVARC:RefTable CLONE QUIET'
CALL DirectENV
/* ------------------------- */
Msg="j_ManualServerInfo"
Parameter1 = AppName
CALL ShowMessage
/* ------------------------- */
Msg="m1_assigns_startup"
Parameter1 = AppName
Parameter2 = MARInA_bin
Parameter3 = MARInA_rexx
CALL ShowMessage
Msg_Enhance1 = 'm2_assigns_startup'
Parameter1 = AppName
Module = RootPath'SYS/ModAS/ModAS.part'
First12 = ';ModAS © TNE'
Last12 = ';END ModAS P'
CALL EnhanceStartup
/* ------------------------- */
Startup:
InstName = ' Startup-File '
Init_File = 'SYS:StartSys/Install/MARInA'
Command.1 = 'echo " Installing..'InstApp'... The Ultimate Wizard System."'
Command.2 = 'assign MARInA_bin: 'MARInA_bin
Command.3 = 'assign MARInA_bin: SYS:c ADD'
Command.4 = 'assign MARInA_bin: SYS:Prefs ADD'
Command.5 = 'assign MARInA_bin: SYS:System ADD'
Command.6 = 'assign MARInA_bin: SYS:Tools ADD'
Command.7 = 'assign MARInA_bin: SYS:Tools/Commodities ADD'
Command.8 = 'assign MARInA_bin: SYS:Utilities ADD'
Command.9 = 'assign MARInA_rexx: 'MARInA_rexx
Command.10 = 'path MARInA_bin: ADD'
n=10
CALL Create_InitScript
/* ------------------------- */
CALL Config_MARInAPrefs
InstName = ' IDer Prefs '
CALL IDerPrefs
InstName = ' MARInA Docs '
CALL CopyHelp
/* ------------------------- */
Msg="q_enhance_Infos"
Parameter1 = AppName
CALL ShowMessage
/* ------------------------- */
InstName = ' MARInA Trash '
CALL CreateTrash
/* ------------------------- */
Msg="r_ExampleConfigs"
Parameter1 = AppName
CALL ShowMessage
/* ------------------------- */
CALL RenameIcons
InstName = ' ToolManager '
CALL TM_Dock
/* ------------------------- */
CALL Un_UnInstallScripts
Result = PRAGMA('DIRECTORY', CurrentDir)
Msg="_last_Infos"
Parameter1 = AppName
CALL ShowMessage
ADDRESS COMMAND
'setenv ACTUALPATH 'RootPath'Extras'
'${RefTable/File-Manager}'
MustQuit=1
CALL ExitMe
/* -------------- BEGIN Specific Procedures ------------------ */
CopyRefTable:
DO FOREVER
Msg="f_RefTable_copy"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 1) THEN
LEAVE
IF (Action = 2) THEN
CALL ShowRefHelp
IF (Action = 0) THEN
CALL ExitMe
END
InstName = ' RefTable Standard '
SourceDir = RootPath'SYS/Inst_RefTable'
DestDir1 = 'ENVARC:RefTable'
DestDir2 = 'ENV:RefTable'
DoNotRemoveDir = 1
CALL CopyAction
/* User RefTable configuring dialog ----- */
Msg="g_UserReferences"
Parameter1 = AppName
CALL ShowMessage
Msg="g_UserReferences2"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN
CALL ExitMe
ADDRESS COMMAND
'failat 21'
list' >'EditList RootPath'SYS/Inst_RefEdit FILES LFORMAT "%s%s"'
'Install_C:sort from 'EditList' to 'EditList
IF ~Open(fTmp, EditList, 'read') THEN
Err_ShowMessage(EditList)
ELSE
DO
i=1
DO UNTIL EOF(fTmp)
File.i = ReadLn(fTmp)
i=i+1
END
Closed = Close(fTmp)
i = i-2
ADDRESS COMMAND
delete'' EditList 'QUIET'
END
DO j=1 to i /* Let user configure own Refs */
Replace = ReadConfigFile(File.j)
IF (Replace = "NOTHING" | Replace = 'REPLACE') THEN Replace = ''
IF (LASTPOS('/', File.j) > 1) THEN
DirPos = LASTPOS('/', File.j)
ELSE
DirPos = LASTPOS(':', File.j)
Length = LENGTH(File.j)
FileName = RIGHT(File.j, Length-DirPos)
ENVVAR = '${RefTable/'FileName'}'
RefT_Ask = 1
Replaced = 0
CALL AskEdit
IF (RefJump = 1) THEN LEAVE
Result = WriteConfigFile(File.j, NewPath, Descr1, Descr2, Descr3, Descr4)
END
RefT_Ask = 0
InstName = ' User References '
SourceDir = RootPath'SYS/Inst_RefEdit'
DestDir1 = 'ENV:RefTable'
DestDir2 = 'ENVARC:RefTable'
CALL CopyAction
RETURN
/*----------------------------------------------------------------*/
AskEdit:
DO FOREVER
IF (Replaced=1 & RefT_Ask=1) THEN
DO
IF (UPPER(RIGHT(SelectedFile, 5))='.REXX') THEN
Replace = 'SYS:RexxC/rx 'SelectedFile
ELSE
DO
IF (UPPER(RIGHT(SelectedFile, 7))='.SCRIPT' | UPPER(RIGHT(SelectedFile,4))='.SCR' | UPPER(RIGHT(SelectedFile,4))='.BAT' | UPPER(RIGHT(SelectedFile,6))='.SHELL' | UPPER(RIGHT(SelectedFile,6))='.START') THEN
Replace = 'SYS:c/execute 'SelectedFile
ELSE
DO
SUp = UPPER(SelectedFile)
IF (EXISTS(SelectedFile'.info') & POS('IBROWSE',SUp)=0 & POS('AWEB',SUp)=0 & POS('VOYAGER',SUp)=0) THEN
Replace = 'MARInA_bin:WBrun 'SelectedFile
END
END
END
IF (POS('-OPTS', UPPER(ENVVAR)) > 1 | POS('-RX-', UPPER(ENVVAR)) > 1) THEN
Msg = '_ReferencePrefs.21'
ELSE
Msg = '_ReferencePrefs.2'
Parameter1 = ENVVAR
Parameter2 = Descr1
Parameter3 = Descr2
Parameter4 = '(Var. 'j'/'i')'
PresetString = Replace
IF ~(UPPER(Language)='DEUTSCH') THEN
DO
Parameter2 = Descr3
Parameter3 = Descr4
END
CALL ShowMessage
NewPath = SelectedString
IF (Action = 0) THEN
DO
RefJump = 1
LEAVE
END
IF (Action = 1 & POS('$',SelectedString)=0 ) THEN
LEAVE
IF (POS('$',SelectedString)>0 ) THEN
DO
Msg = '_ReferencePrefs.7'
Parameter1 = AppName
CALL ShowMessage
END
Replaced = 0
IF (Action=2 & Msg='_ReferencePrefs.2') THEN
DO
Msg = '_ReferencePrefs.3'
Parameter1 = ENVVAR
Parameter2 = AppName
ActualPath = 'SYS:'
ActualName = ''
CALL ShowMessage
IF (EXISTS(SelectedFile) & ~(SelectedFile = '')) THEN
DO
Replaced = 1
Replace = SelectedFile
END
END
IF ((Action=3 & Msg='_ReferencePrefs.2') | (Action=2 & Msg='_ReferencePrefs.21')) THEN
CALL ShowRefHelp
END
RETURN
/*---------------------*/
ShowRefHelp:
Msg = '_ReferencePrefs.4'
Parameter1 = AppName
CALL ShowMessage
Msg = '_ReferencePrefs.5'
Parameter1 = AppName
CALL ShowMessage
drop Action
RETURN
/*--------Direct ENV-Files ---------------------------*/
DirectENV:
/*--edit Direct ENV-Files --------*/
Msg="i_EDIT_ENVs"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN
CALL ExitMe
/* --------------- */
File = 'ENV:EDIT'
IF EXISTS(File) THEN
Replace = ReadConfigFile(File)
ELSE
Replace = 'SYS:c/ed'
IF (Replace = "NOTHING" | Replace = "REPLACE") THEN Replace = ""
ENVVAR = '$EDIT'
ActualPath = 'SYS:'
j=1
i=2
CALL AskEdit
Result = WriteConfigFile(File, NewPath, Descr1, Descr2, Descr3, Descr4)
Command.1 = 'setenv EDIT 'Replace
/* --------------- */
File = 'ENV:EDITOR'
IF EXISTS(File) THEN
Replace = ReadConfigFile(File)
ELSE
Replace = 'SYS:c/ed'
IF (Replace = "NOTHING" | Replace = "REPLACE") THEN Replace = ""
ENVVAR = '$EDITOR'
ActualPath = 'SYS:'
j=2
i=2
CALL AskEdit
Result = WriteConfigFile(File, NewPath, Descr1, Descr2, Descr3, Descr4)
Command.2 = 'setenv EDITOR 'Replace
Command.3 = copy' ENV:EDIT#? ENVARC: CLONE ALL QUIET'
CALL Do_and_Log
RETURN
/*----------------------------*/
ReadConfigFile:
PARSE ARG name
IF (open(fTmp, name, 'read')) THEN
DO
value = ReadLn(fTmp)
Descr1 = ReadLn(fTmp)
Descr2 = ReadLn(fTmp)
Descr3 = ReadLn(fTmp)
Descr4 = ReadLn(fTmp)
Closed = close(fTmp)
END
ELSE
DO
value = "NOTHING"
END
RETURN value
/*----------------------------*/
WriteConfigFile: PROCEDURE
PARSE ARG name, argument, Descr1, Descr2, Descr3, Descr4
ADDRESS COMMAND
'delete' name 'QUIET'
IF ~open(fTmp, name, 'write') THEN
Err_ShowMessage(name)
ELSE
DO
Result = WriteLn(fTmp, argument)
Result = WriteLn(fTmp, Descr1)
Result = WriteLn(fTmp, Descr2)
Result = WriteLn(fTmp, Descr3)
Result = WriteLn(fTmp, Descr4)
Closed = close(fTmp)
END
RETURN 1
/* ---------------------------------------------- */
Config_MARInAPrefs:
Msg="n_ReqPrefs"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN
CALL ExitMe
ADDRESS COMMAND
'${RefTable/Prefs-MARInA-Req}'
RETURN
/* ---------------------------------------------- */
IDerPrefs:
Msg="o_IDer"
Parameter1 = AppName
CALL ShowMessage
IF ~EXISTS('ENV:IDer.prefs') THEN
DO
Command.1 = copy RootPath'ExampleConfigs/IDer#?.prefs ENV: CLONE QUIET'
Command.2 = copy RootPath'ExampleConfigs/IDer#?.prefs ENVARC: CLONE QUIET'
END
ELSE
DO
Command.1 = copy' ENVARC:IDer.prefs ENVARC:IDer.prefsOrig CLONE QUIET'
Command.2 = copy RootPath'ExampleConfigs/IDer#?.prefs ENV: CLONE QUIET'
Command.3 = copy RootPath'ExampleConfigs/IDer#?.prefs ENVARC: CLONE QUIET'
END
CALL Do_and_Log
/* ----Un_IDer:-------- */
r=WLine('if exists ENV:IDer.prefsOrig')
r=WLine(' ask "
Restore
your ENVARC:
IDer.prefs
? [y/n] "')
r=WLine(' if warn')
r=WLine(' copy ENVARC:IDer.prefsOrig ENVARC:IDer.prefs CLONE')
r=WLine(' copy ENV:IDer.prefsOrig ENV:IDer.prefs CLONE')
r=WLine(' delete ENVARC:IDer.prefsOrig QUIET')
r=WLine(' delete ENV:IDer.prefsOrig QUIET')
r=WLine(' echo " Original ENVARC:IDer.prefs restored!"')
r=WLine(' endif')
r=WLine('else')
r=WLine(' ask "
Remove
ENVARC:IDer.prefs ? [y/n] "')
r=WLine(' if warn')
r=WLine(' delete ENV:IDer.prefs ENVARC:IDer.prefs')
r=WLine(' endif')
r=WLine('endif')
CALL SpaceNextEntry
RETURN
/* ------------------------------------------------------- */
InstallVoice:
IF (DoesNotExist = 1) THEN
DO
Msg = 'l1_NoVoice'
Parameter1 = AppName
CALL ShowMessage
DoesNotExist = 0
END
ELSE
DO
Msg = 'l1_Voice'
Parameter1 = AppName
CALL ShowMessage
END
IF (Action=0) THEN CALL ExitMe
InstName = ' SysVoice '
InstAssign = 'SysVoice:'
SourceDir = RootPath'SYS/Inst_Voice'
DestDir1 = 'SYS:Locale/Voice'
CALL CopyAction
RETURN
/* ------------------------------------------------------- */
CreateTrash:
Command.1 = copy' SYS:.backdrop.bak SYS:.backdrop CLONE QUIET'
Command.2 = copy' SYS:.backdrop SYS:.backdrop.bak CLONE QUIET'
ADDRESS COMMAND 'Install_C:search >ENV:SearchResult from SYS:.backdrop :Trashcan'
Result = MyGetENV('SearchResult')
ADDRESS COMMAND 'delete ENV:SearchResult QUIET'
IF (EXISTS('SYS:.backdrop') & POS(':Trashcan', Result) = 0) THEN
Command.3 = 'echo >>SYS:.backdrop ":Trashcan"'
ELSE
Command.3 = ''
Command.4 = RootPath'SYS/Choice_MARInA_bin/DrawIcon SYS:Trashcan'
CALL Do_and_Log
RETURN
/* ------------------------------------------------------- */
TM_Dock:
Msg="u1_Test_Dock"
Parameter1 = InstApp
CALL ShowMessage
IF (Action = 0) THEN CALL ExitMe
CALL QuitCommodities
TM_wasActive = TM_active
RK_wasActive = RK_active
TM_Cmd = CommodityPath('ToolManager')
RK_cmd = CommodityPath('ReKeyIt')
ADDRESS COMMAND
copy 'ENV:ToolManager.prefs ENV:ToolManager.prefs.bak CLONE QUIET'
copy RootPath'ExampleConfigs/'Language'/ToolManager.prefs ENV:ToolManager.prefs CLONE QUIET'
copy 'S:RekeyIt.menus S:RekeyIt.menus.bak CLONE QUIET'
copy RootPath'ExampleConfigs/'Language'/RekeyIt.menus S:RekeyIt.menus CLONE QUIET'
assign 'DOCK: 'RootPath'SYS/Inst_TM/Prefs/Dock ADD'
TM_Cmd
wait' 4'
'MARInA_bin:WBrun 'RootPath'SYS/Inst_TM/WBstartup/RekeyIt'
/* --------------------------------------- */
Msg="v1_InfoFileManager"
Parameter1 = AppName
CALL ShowMessage
Msg="v2_InfoFileManager"
Parameter1 = AppName
CALL ShowMessage
Msg="v3_InfoFileManager"
Parameter1 = AppName
CALL ShowMessage
Msg="v4_InfoFileManager"
Parameter1 = AppName
CALL ShowMessage
Msg="u2_Take_Dock"
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN
CALL ExitMe
IF (Action = 2) THEN /* Remove Test-Installation */
DO
IF EXISTS('ENV:ToolManager.prefs.bak') THEN
DO
CALL QuitCommodities
ADDRESS COMMAND
move' ENV:ToolManager.prefs.bak ENV:ToolManager.prefs CLONE QUIET'
move' S:RekeyIt.menus.bak S:RekeyIt.menus CLONE QUIET'
END
IF (TM_wasActive = 1) THEN
DO
ADDRESS COMMAND
TM_Cmd
'wait 5'
END
IF (RK_wasActive = 1) THEN ADDRESS COMMAND RK_Cmd
CALL RemoveTempAssigns
RETURN
END
/* Install for real */
CALL RemoveTempAssigns
CALL QuitCommodities
IF EXISTS('ENVARC:ToolManager.prefs') THEN
DO
Command.1=move' ENVARC:ToolManager.prefs ENVARC:ToolManager.prefs.bak QUIET'
Command.2='wait 2'
CALL Do_and_Log
END
InstName = ' ToolManager '
SourceDir=RootPath'SYS/Inst_TM'
DestDir1='SYS:'
DoCheck=1
CALL CopyAction
Command.1=copy' /ExampleConfigs/'Language'/ToolManager.prefs ENVARC: CLONE QUIET'
Command.2=copy' /ExampleConfigs/'Language'/ToolManager.prefs ENV: CLONE QUIET'
Command.3=assign' Dock: SYS:Prefs/Dock ADD'
Command.4=TM_cmd
Command.5=wait' 4'
Command.6='MARInA_bin:WBrun SYS:WBstartup/ReKeyIt'
CALL Do_and_Log
RETURN
/* --------------- */
QuitCommodities:
ADDRESS COMMAND
'MARInA_bin:CLIexchange >ENV:TM_info ToolManager INFO'
'MARInA_bin:CLIexchange >ENV:RK_info ReKeyIt INFO'
IF (LEFT(MyGetENV('TM_info'),11)='ToolManager') THEN
DO
ADDRESS COMMAND 'MARInA_bin:CLIexchange ToolManager KILL'
TM_active = 1
END
IF (LEFT(MyGetENV('RK_info'),7)='ReKeyIt') THEN
DO
ADDRESS COMMAND 'MARInA_bin:CLIexchange ReKeyIt KILL'
RK_active = 1
IF RealLanguage='deutsch' THEN
DO
ADDRESS COMMAND
'MARInA_bin:SWindow >NIL: "Nachricht von ReKeyIt" 100 100 p p'
'MARInA_bin:SWindow >NIL: "Nachricht von ReKeyIt" f'
END
ELSE
DO
IF RealLanguage='français' THEN
DO
ADDRESS COMMAND
'MARInA_bin:SWindow >NIL: "Message de ReKeyIt" 100 100 p p'
'MARInA_bin:SWindow >NIL: "Message de ReKeyIt" f'
END
ELSE
DO
ADDRESS COMMAND
'MARInA_bin:SWindow >NIL: "Message from ReKeyIt" 100 100 p p'
'MARInA_bin:SWindow >NIL: "Message from ReKeyIt" f'
END
END
ADDRESS COMMAND wait' 5'
END
RETURN
/* --------------- */
CommodityPath:
PARSE ARG cdity
Cmd = ''
IF ~(RK_WasActive=1) THEN Cmd='dummy'
IF EXISTS('SYS:WBstartup/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:WBstartup/'cdity
IF EXISTS('SYS:Commodities/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Commodities/'cdity
IF EXISTS('SYS:Commods/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Commods/'cdity
IF EXISTS('SYS:Cdity/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Cdity/'cdity
IF EXISTS('SYS:Tools/Commodities/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Tools/Commodities/'cdity
IF EXISTS('SYS:Tools/Commods/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Tools/Commods/'cdity
IF EXISTS('SYS:Tools/Cdity/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Tools/Cdity/'cdity
IF EXISTS('SYS:Tools/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Tools/'cdity
IF EXISTS('SYS:Utilities/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:Utilities/'cdity
IF EXISTS('SYS:WBstartup+/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:WBstartup+/'cdity
IF EXISTS('SYS:System/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:System/'cdity
IF EXISTS('SYS:c/'cdity) THEN
Cmd = 'MARInA_bin:WBrun SYS:c/'cdity
IF (Cmd='' & cdity='ToolManager') THEN
DO
Msg="u0_ToolManagerPath"
Parameter1=cdity
ActualPath="SYS:WBstartup"
ActualName=cdity
CALL ShowMessage
Cmd=SelectedFile
END
RETURN Cmd
/* --------------- */
RemoveTempAssigns:
ADDRESS COMMAND
assign' DOCK: 'RootPath'SYS/Inst_TM/Prefs/Dock REMOVE'
RETURN
/* ------------ BEGIN Standard MARInA Installer --------------- */
Init:
AppName = "© TNE) 98 MARInA Installer"
CR = '0a'x
IF ~show('L','rexxreqtools.library') THEN
r=ADDLIB('rexxreqtools.library',0,-30,0)
IF ~show('L','rexxsupport.library') THEN
r=ADDLIB('rexxsupport.library',0,-30,0)
ProcessNumber=PRAGMA('ID')
CALL FORBID
Intui = showlist(l, 'intuition.library',, a)
Screen = next(intui, 56)
Font = next(screen, 136)
FontSize = c2d(import(offset(font, 20), 2))
CALL PERMIT
MaxTitleChars = 60
ReqLE = 70 /* Main Window */
ReqTE = 80
ConsoleType = 'CON:'
ConsoleSize = ReqLE'/'ReqTE'/600/200'
ReqHeight = 350
rt_TE1 = ReqTE + FontSize + 4 /* Requester-Windows */
rt_LE1 = ReqLE + 6
PosTags = "rt_reqpos=reqpos_topleftscr rt_leftoffset=" ReqLE " rt_topoffset=" ReqTE
EZtags = PosTags
GLtags = PosTags || "rtgl_min=0 rtgl_max=1500 rtgl_backfill=true "
GStags = PosTags || " rtgs_backfill=false rtgs_width=300"
POINTER_TAGS = "rt_reqpos=reqpos_pointer"
DIR_TAGS = PosTags || " rtfi_flags=freqf_nofiles|freqf_save rtfi_height=" ReqHeight
FILE_TAGS = PosTags || " rtfi_flags=freqf_multiselect|freqf_selectdirs" || " rtfi_height=" ReqHeight
ONEFILE_TAG = PosTags || " rtfi_height=" ReqHeight
Console = '>"'ConsoleType || ConsoleSize'/'AppName' Messages.../AUTO/NOClose"'
/*---- specials -------------------*/
EditList = 'T:MARInA_Edit_Configs'
CurrentDir = MyGetENV('ACTUALINSTALL')
r=PRAGMA('DIRECTORY', CurrentDir)
Pos=POS('Install-Guide', CurrentDir)
RootPath=LEFT(CurrentDir,Pos-1)
ADDRESS COMMAND RootPath'Install-Guide/c/assign Install_C: 'RootPath'Install-Guide/c'
CALL GetLanguage
Additional_S = ''
Additional_C = ''
Additional_L = ''
Additional_Libs = ''
Additional_Devs = ''
Additional_Fonts = ''
Additional_Locale = ''
Additional_Help = ''
ItemNr = 0
InstName = InstApp
InstAssign = ''
InstDest2 = ''
CopyMsg2 = ''
DestDir2 = ''
Recursive = 'ALL'
DoNotRemoveDir = 0
PhaseA_exists = 0
assign='Install_C:assign'
copy='Install_C:copy'
delete='Install_C:delete'
execute='Install_C:execute'
list='Install_C:list'
makedir='Install_C:makedir'
move='Install_C:move'
wait='Install_C:wait'
CheckSourceFile = 'T:CS_FileList_'ProcessNumber
CheckSourceDirs = 'T:CS_DirsList_'ProcessNumber
TempPath = 'CS_Dest-path'ProcessNumber
RETURN
/* ------------------------------------------------------- */
Copy_SrcDest:
Msg=MsgSrcDest
Parameter1 = AppName
CALL ShowMessage
IF (RIGHT(InstDest1,1)=':') THEN
InstDest1_Dir=InstDest1
ELSE
InstDest1_Dir=InstDest1'/'
IF (RIGHT(InstDest2,1)=':') THEN
InstDest2_Dir=InstDest2
ELSE
InstDest2_Dir=InstDest2'/'
IF (Action=1) THEN
DO
Selected_Dest = InstDest1
Selected_Dest_Dir = InstDest1_Dir
END
IF (Action=2) THEN
DO FOREVER
Msg = '_PathReq' /* GetPath */
Parameter1 = AppName
Parameter2 = InstName
ActualPath = 'SYS:'
CALL ShowMessage
Selected_Dest_Dir = SelectedPath
IF (Selected_Dest_Dir = "") THEN
Selected_Dest_Dir = InstDest1_Dir
Selected_Dest = STRIP(Selected_Dest_Dir, 'T', '/')
Msg=MsgOtherDir
Parameter1 = AppName
Parameter2 = Selected_Dest
CALL ShowMessage
IF (Action=1) THEN LEAVE
IF (Action=0) THEN CALL ExitMe
END
IF (Action=0) THEN CALL ExitMe
SourceDir = InstSource
DestDir1 = Selected_Dest
IF ~(InstDest2 = '') THEN
DO
IF (UPPER(Selected_Dest) = UPPER(InstDest1)) THEN
DestDir2 = InstDest2
END
CALL CopyAction
CopyMsg2 = ''
InstDest2 = ''
InstDest2_Dir = ''
RETURN
/* ---------------------------- */
CopyAction:
IF (RIGHT(DestDir1,1)=':' | RIGHT(DestDir1,1)='/') THEN
DestDir1_Dir=DestDir1
ELSE
DestDir1_Dir=DestDir1'/'
IF (RIGHT(DestDir2,1)=':' | RIGHT(DestDir2,1)='/') THEN
DestDir2_Dir=DestDir2
ELSE
DestDir2_Dir=DestDir2'/'
IF (DoCheck=1) THEN
DO
DestDir = DestDir1_Dir
CALL CopySecure
r=PRAGMA('DIRECTORY', CurrentDir)
IF ~(DestDir2 = '') THEN
DO
DestDir = DestDir2_Dir
CALL CopySecure
END
r=PRAGMA('DIRECTORY', CurrentDir)
DoCheck=0
END
ELSE
DO
Console = '>"'ConsoleType''ConsoleSize'/'AppName' Messages... copying to 'DestDir1'/AUTO/NOClose"'
Command.1 = copy Console SourceDir '"'DestDir1'" CLONE 'Recursive
IF ~(DestDir2 = '') THEN
DO
Console = '>"'ConsoleType''ConsoleSize'/'AppName' Messages... copying to 'DestDir2'/AUTO/NOClose"'
Command.2 = copy Console SourceDir '"'DestDir2'" CLONE 'Recursive
END
CALL Do_and_Log
IF (ResultCommand = 10) THEN
DO
DestFull=1
CALL ExitMe
END
END
IF ~(InstAssign = '') THEN
DO
Command.1 = assign' 'InstAssign' 'DestDir1' ADD'
CALL Do_and_Log
IF (UPPER(InstAssign)='S:') THEN Additional_S = DestDir1
IF (UPPER(InstAssign)='C:') THEN Additional_C = DestDir1
IF (UPPER(InstAssign)='L:') THEN Additional_L = DestDir1
IF (UPPER(InstAssign)='LIBS:') THEN Additional_Libs = DestDir1
IF (UPPER(InstAssign)='DEVS:') THEN Additional_Devs = DestDir1
IF (UPPER(InstAssign)='FONTS:') THEN Additional_Fonts = DestDir1
IF (UPPER(InstAssign)='LOCALE:') THEN Additional_Locale = DestDir1
IF (UPPER(InstAssign)='HELP:') THEN Additional_Help = DestDir1
END
/* -----Undo_copy:------- */
ItemNr = ItemNr + 1
DeInstallScript = UnInstDir'/'UnInstScrName'.'ItemNr
r=PRAGMA('DIRECTORY', SourceDir)
ADDRESS COMMAND
'echo >'DeInstallScript' "failat 30"'
'list >>'DeInstallScript' FILES 'Recursive' LFORMAT "delete 'DestDir1_Dir'%s%s"'
IF ~(DestDir2 = '') THEN
DO
ADDRESS COMMAND
'list >>'DeInstallScript' FILES 'Recursive' LFORMAT "delete 'DestDir2_Dir'%s%s"'
END
r=PRAGMA('DIRECTORY', CurrentDir)
DeInstallScript = 'T:'UnInstScrName'.'ItemNr
r=WLine('if exists "'DestDir1'"')
r=WLine(' ask " Remove
'InstName'
-Files in Directory
'DestDir1'
? [y/n]"')
r=WLine(' if warn')
r=WLine(' execute 'DeInstallScript)
r=WLine(' delete 'DeInstallScript' QUIET')
r=WLine(' endif')
r=WLine('endif')
CALL SpaceNextEntry
IF (DoNotRemoveDir = 0) THEN
DO
r=UPPER(DestDir1)
IF ~(r='WORK:' | r='SYS:' | r='SYS:PREFS' | r='SYS:TOOLS' | r='SYS:UTILITIES' | r='ENVARC:' | r='SYS:C' | r='SYS:LIBS' | r='ENV:' | r='C:' | r='S:' | r='L:' | r='FONTS:' | r='LIBS:' | LEFT(r,5)='DEVS:' | LEFT(r,7)='LOCALE:' | LEFT(r,5)='HELP:') THEN
DO
r=WLine('if exists "'DestDir1'"')
r=WLine(' ask "
Remove
the whole Directory
'DestDir1'
? [y/n]"')
r=WLine(' if warn')
IF ~(InstAssign = '') THEN
DO
r=WLine(' path 'DestDir1' REMOVE')
r=WLine(' path 'InstAssign' REMOVE')
r=WLine(' path 'InstAssign' REMOVE')
u=UPPER(InstAssign)
IF ~(u = "S:" | u = "C:" | u = "L:" | u = "LIBS:" | u = "DEVS:" u = "FONTS:" | u = "LOCALE:" | u = "HELP:" | u = "SYS:") THEN
r=WLine(' assign 'InstAssign' REMOVE')
IF (u = "S:") THEN
r=WLine(' assign 'InstAssign' 'Additional_S' REMOVE')
IF (u = "C:") THEN
r=WLine(' assign 'InstAssign' 'Additional_C' REMOVE')
IF (u = "L:") THEN
r=WLine(' assign 'InstAssign' 'Additional_L' REMOVE')
IF (u = "LIBS:") THEN
r=WLine(' assign 'InstAssign' 'Additional_Libs' REMOVE')
IF (u = "DEVS:") THEN
r=WLine(' assign 'InstAssign' 'Additional_Devs' REMOVE')
IF (u = "FONTS:") THEN
r=WLine(' assign 'InstAssign' 'Additional_Fonts' REMOVE')
IF (u = "LOCALE:") THEN
r=WLine(' assign 'InstAssign' 'Additional_Locale' REMOVE')
IF (u = "HELP:") THEN
r=WLine(' assign 'InstAssign' 'Additional_Help' REMOVE')
END
r=WLine(' wait 1')
r=WLine(' delete "'DestDir1'" ALL FORCE')
IF ~(DestDir2 = '') THEN
r=WLine(' delete "'DestDir2'" ALL FORCE')
r=WLine(' endif')
r=WLine('endif')
CALL SpaceNextEntry
END
END
InstAssign = ''
DestDir2 = ''
DestDir2_Dir = ''
Recursive = 'ALL'
InstName = InstApp
DoNotRemoveDir = 0
RETURN
/* --------------------------------------CopySecure------- */
CopySecure:
ShowConsole = ConsoleType''ReqLE'/'ReqTE'/584/124/'AppName' Messages... copying to 'DestDir'/NOCLOSE'
IF ~(Open(Con, ShowConsole, 'write')) THEN
DO
MsgFile = ThisConsole
CALL Err_ShowMessage
END
r = writeln(Con, " ")
r = writeln(Con, " Please wait, Searching duplicate files and copying is in action.")
r = writeln(Con, " ")
r = writeln(Con, " Source Folder: "SourceDir)
r = writeln(Con, " Destin Folder: "DestDir)
Files.count = 1
Files.1 = SourceDir
CALL FileParser
FileOp = copy
FileOpOpts = 'CLONE 'Recursive
k=1
DoIt = 1
IconExists = 0
IF ~(RIGHT(Files.1,1)=':') THEN Files.1=Files.1'/'
CALL CheckSource
MainDestDir = DestDir
MainDirLength = LENGTH(Files.k)
theDir=strip(MainDestDir,'T','/')
IF (IsDir(theDir) = -1) THEN ADDRESS COMMAND 'makedir "'theDir'"'
/* Create Destination Sub-Directories */
IF (DirCount > 0) THEN
DO SubCount = 1 to DirCount
ThisDestDir = MainDestDir || RIGHT(SourceDir.SubCount, LENGTH(SourceDir.SubCount)-MainDirLength)
MakeDestDir = Strip(ThisDestDir, 'T', '/')
IF (IsDir(MakeDestDir) = -1) THEN ADDRESS COMMAND 'makedir' MakeDestDir
END
IF (SourceCount > 0) THEN
DO SubCount = 1 to SourceCount
ActualFile = SourceDirs.SubCount || SourceFiles.SubCount
Target = MainDestDir || RIGHT(SourceDirs.SubCount, LENGTH(SourceDirs.SubCount)-MainDirLength) || SourceFiles.SubCount
IF ~(DoIt=3) THEN CALL CheckExist
IF (DoIt=1 | DoIt=3) THEN CALL DoCopy
IF (DoIt=0) THEN LEAVE
END
r = Close(Con)
RETURN
/* ----------------------------- */
DoCopy:
ADDRESS COMMAND FileOp '"'ActualFile'" "'Target'" 'FileOpOpts
Code=RC
IF (Code=5) THEN
DO
Msg = '_CopyFull'
Parameter1 = AppName
Parameter2 = Target
CALL ShowMessage
IF (Action=1) THEN
DO
ADDRESS COMMAND
'protect "'Target'" +wd'
FileOp '"'ActualFile'" "'Target'" 'FileOpOpts
END
Code=RC
END
IF (Code=10) THEN
DO
DestFull=1
CALL ExitMe
END
RETURN
/* ----------------------------- */
CheckSource:
Source_is_Dir = 0 /* Preset */
SourceCount = Files.count - k
SubCount = 0
IF (IsDir(Files.k) = 1) THEN
DO
Source_is_Dir = 1
ADDRESS COMMAND
'list 'Files.k' >'CheckSourceDirs' ALL DIRS LFORMAT="%p%s"'
'list 'Files.k' >'CheckSourceFile' ALL FILES LFORMAT="%p*n%s"'
SourceCount = 1
IF (Open(fTmp, CheckSourceFile, 'read')) THEN
DO
DO UNTIL (EOF(fTmp))
SourceDirs.SourceCount = ReadLn(fTmp)
SourceFiles.SourceCount = ReadLn(fTmp)
SourceCount = SourceCount + 1
END
SourceCount = SourceCount - 2 /* 2 Lines Overhead in each "list" File */
r=Close(fTmp)
ADDRESS COMMAND delete CheckSourceFile 'QUIET'
END
IF (Open(fTmp, CheckSourceDirs, 'read')) THEN
DO
DirCount = 1
DO UNTIL (EOF(fTmp))
SourceDir.DirCount = ReadLn(fTmp)
DirCount = DirCount + 1
END
DirCount = DirCount - 2 /* 2 Lines Overhead in each "list" File */
r=Close(fTmp)
ADDRESS COMMAND delete CheckSourceDirs 'QUIET'
END
END
RETURN
/* ----------------------------- */
CheckExist:
DoIt = 1 /* Preset */
IF (Files.count > 1 | Source_is_Dir = 1) then
MsgOffset = 3
ELSE
MsgOffset = 0
IF (EXISTS(Target) & EXISTS(ActualFile)) THEN
DO
sz_AttrSource = GetFileAttributes(ActualFile)
sz_AttrDest = GetFileAttributes(Target)
Rest = SourceCount-SubCount
IF (Rest > 1) THEN MsgNr = 2 + MsgOffset
IF (Rest = 1) THEN MsgNr = 3 + MsgOffset
IF (Rest = 0) THEN MsgNr = 4 + MsgOffset
Msg = "_CopyReplace."MsgNr
Parameter1 = sz_AttrDest
Parameter2 = sz_AttrSource
Parameter3 = Rest
Parameter4 = k
Parameter5 = Files.count
Parameter6 = AppName
CALL ShowMessage
DoIt = Action
END
RETURN
/* ----------------------------- */
GetFileAttributes:
PARSE ARG CheckedFile
BytesTemp = 'ENV:FM_Bytes'ProcessNumber
AttrFile = 'T:FM_Attr_'ProcessNumber
ADDRESS COMMAND
'list >'AttrFile' "'CheckedFile'" LFORMAT " %n*n %l Bytes*n %p*n %d %t*n %c"'
'echo >>'AttrFile' " Version: " NOLINE'
IsExecutable = CheckExecutable(CheckedFile)
ADDRESS COMMAND
'list >'BytesTemp' "'CheckedFile'" LFORMAT "%l"'
IF (Open(fTmp, BytesTemp, 'read')) THEN
DO
Bytes = VALUE(ReadLn(fTmp))
r=Close(fTmp)
END
IF ((IsExecutable & Bytes < 800000)) THEN
DO
ADDRESS COMMAND
'version >>'AttrFile' "'CheckedFile'"'
END
IF (Open(fTmp, AttrFile, 'read')) THEN
DO
sz_Attr = ReadLn(fTmp)
sz_Attr = sz_Attr || CR || ReadLn(fTmp)
sz_Attr = sz_Attr || CR || LEFT(ReadLn(fTmp), 85)
sz_Attr = sz_Attr || CR || ReadLn(fTmp)
sz_Attr = sz_Attr || CR || LEFT(ReadLn(fTmp), 85)
IF ((IsExecutable & Bytes < 800000) | Bytes < 100000) THEN
DO
Version = LEFT(ReadLn(fTmp), 70)
IF ~(LEFT(Version, 34) = " Version: Could not find") THEN
sz_Attr = sz_Attr || CR || Version
END
r=Close(fTmp)
END
ADDRESS COMMAND
delete AttrFile 'QUIET'
delete BytesTemp 'QUIET'
RETURN sz_Attr
/*----------------------------------------*/
CheckExecutable:
PARSE ARG CheckExeFile
Flag = 0
IF (Open(fTmp, CheckExeFile, 'read')) THEN
DO
Head = ReadCh(fTmp, 4)
HeaderBytes = c2x(Head)
r=Close(fTmp)
END
IF (HeaderBytes = "000003F3") THEN /* Executable */
Flag = 1
RETURN Flag
/*------------------------------------IsDir--------*/
IsDir: PROCEDURE
PARSE ARG name
name = strip(name, 'T', '/')
returned = PRAGMA('DIRECTORY', name)
IF ~(returned = "") THEN
DirFlag = 1
ELSE
DO
IF ~Exists(name) then
DirFlag = -1
ELSE
DirFlag = 0
END
RETURN DirFlag
/*----------------------------------FileParser--------*/
FILEPARSER:
PrognameBegPos = 0
DevicePos = 0
DirPos = 0
SfxBegin = 0
i=1
CALL Analyze
i=Files.count /* set last path to Actual path */
Path = Path.i
RETURN
/*----------------------------------------*/
Analyze:
Laenge = LENGTH(Files.i)
DevicePos=LASTPOS(':',Files.i)
DirPos=LASTPOS('/',Files.i)
IF(DirPos > 1) THEN
DO
PrognameBegPos=DirPos
Path1 = LEFT(Files.i, DirPos)
Path.i = strip(Path1, T, '/')
END
ELSE
DO
PrognameBegPos=DevicePos
Path.i = LEFT(Files.i, DevicePos)
END
Numchars = Laenge - PrognameBegPos
Device.i = LEFT(Files.i, Devicepos)
FileName.i = RIGHT(Files.i, Laenge-PrognameBegPos)
SfxBegin = LASTPOS('.',FileName.i)
IF (SfxBegin=0) THEN
DO
Prefix.i = FileName.i
Suffix.i = ""
END
ELSE
DO
Prefix.i = LEFT(FileName.i,SfxBegin-1)
Suffix.i = UPPER(RIGHT(Files.i, NumChars-SfxBegin))
END
RETURN 1
/*----------------------------------------------------------------*/
EnhanceStartup:
/* Check s:startup-sequence for a complete ModAS-System, if so, RETURN */
sseqModAS=0
IF (Open(SSSCRIPT, 'S:Startup-Sequence', 'R')) THEN
DO
DO UNTIL EOF(SSSCRIPT)
Line = ReadLn(SSSCRIPT)
IF (LEFT(Line,12) = First12) THEN
DO
sseqModAS=1
LEAVE
END
END
r=Close(SSSCRIPT)
IF (sseqModAS=1) THEN RETURN
END
Msg=Msg_Enhance1
CALL ShowMessage
IF (Action = 1) THEN
StartupFile = 'S:User-Startup'
IF (Action=0) THEN CALL ExitMe
InstName = ' ModAS Startup '
SourceDir=RootPath'SYS/Inst_Start'
DestDir1='SYS:'
CALL CopyAction
r=WLine(' ')
r=WLine(';Remove special things from ModAS:')
r=WLine('if not exists SYS:StartSys/1_Residents')
r=WLine(' delete SYS:StartSys ALL')
r=WLine(' delete SYS:StartSys.info')
r=WLine('endif')
r=WLine(' ')
CALL SpaceNextEntry
NewStartup = StartupFile'_'
IF ~Open(SSCRIPT, NewStartup, 'W') THEN Err_ShowMessage(NewStartup)
IF (EXISTS(StartupFile)) THEN
DO
StartupExisted = 1
IF (Open(OldSCRIPT, StartupFile, 'R')) THEN
DO UNTIL EOF(OldSCRIPT)
Line = ReadLn(OldSCRIPT)
IF (LEFT(Line,12) = First12) THEN
PhaseA_exists = 1
r=SLine(Line) /* read and put */
END
r=Close(OldScript)
END
IF (PhaseA_exists = 1) THEN
DO
r=Close(SSCRIPT)
RETURN
END
IF ~Open(SModule, Module, 'R') THEN Err_ShowMessage(Module)
n=0
DO UNTIL EOF(SModule)
Line = ReadLn(SModule)
r=SLine(Line)
n = n+1
END
r=Close(SModule)
r=Close(SSCRIPT)
ADDRESS COMMAND
copy StartupFile StartupFile'.bak1'
copy NewStartup StartupFile
delete NewStartup 'QUIET'
r=WriteLn(LOGFILE, 'Appended 'InstApp'-Section to 'StartupFile)
CALL LogLine
/* Un_StartupScript:------- */
ItemNr = ItemNr + 1
DeInstallScript = UnInstDir'/'UnInstScrName'.'ItemNr
IF ~Open(RexxSCRIPT, DeInstallScript, 'W') THEN Err_ShowMessage(DeInstallScript)
r=RexxLine("/* Uninstaller for "StartupFile" entries of "InstApp"*/")
r=RexxLine(" ")
r=RexxLine("IF (Open(R_SCRIPT, '"NewStartup"', 'W')) THEN")
r=RexxLine(" DO")
r=RexxLine(" IF (Open(SCRIPT, '"StartupFile"', 'R')) THEN")
r=RexxLine(" DO")
r=RexxLine(" DO UNTIL EOF(SCRIPT)")
r=RexxLine(" Line = ReadLn(SCRIPT)")
r=RexxLine(" ")
r=RexxLine(" IF (UPPER(LEFT(Line,12)) = '"UPPER(First12)"') THEN")
r=RexxLine(" DO FOREVER")
r=RexxLine(" r=ReadLn(SCRIPT)")
r=RexxLine(" IF (UPPER(LEFT(r,12)) = '"UPPER(Last12)"') THEN")
r=RexxLine(" LEAVE")
r=RexxLine(" END")
r=RexxLine(" ELSE")
r=RexxLine(" r=WriteLn(R_SCRIPT, Line) /* read and put */")
r=RexxLine(" END")
r=RexxLine(" r=Close(SCRIPT)")
r=RexxLine(" END")
r=RexxLine(" ")
r=RexxLine(" r=Close(R_SCRIPT)")
r=RexxLine(" END")
r=RexxLine(" ")
r=RexxLine(" ADDRESS COMMAND")
r=RexxLine(" 'copy "StartupFile" "StartupFile".bak2'")
r=RexxLine(" 'copy "NewStartup" "StartupFile"'")
r=RexxLine(" 'delete "NewStartup" QUIET'")
r=RexxLine(" ")
r=RexxLine(" EXIT 0")
r=Close(RexxSCRIPT)
r=WLine('ask "
Restore
the original Startup-File
'StartupFile'
? [y/n]"')
r=WLine('if warn')
r=WLine(' SYS:rexxc/rx 'DeInstallScript)
r=WLine('endif')
CALL SpaceNextEntry
RETURN
/* -------------- */
RexxLine:
PARSE ARG TheLine
r=WriteLn(RexxSCRIPT, TheLine)
RETURN 1
/*----------------------------------------------------------------*/
Create_InitScript:
ADDRESS COMMAND delete Init_File 'QUIET'
IF ~Open(SSCRIPT, Init_File, 'W') THEN Err_ShowMessage(Init_File)
r=SLine('failat 21')
IF ~(Additional_C = '') THEN
DO
n=n+1
Command.n = assign' C: 'Additional_C' ADD'
END
IF ~(Additional_L = '') THEN
DO
n=n+1
Command.n = assign' Libs: 'Additional_L' ADD'
END
IF ~(Additional_Libs = '') THEN
DO
n=n+1
Command.n = assign' Libs: 'Additional_Libs' ADD'
END
IF ~(Additional_Devs = '') THEN
DO
n=n+1
Command.n = assign' Devs: 'Additional_Devs' ADD'
END
IF ~(Additional_Fonts = '') THEN
DO
n=n+1
Command.n = assign' Fonts: 'Additional_Fonts' ADD'
END
IF ~(Additional_Locale = '') THEN
DO
n=n+1
Command.n = assign' Locale: 'Additional_Locale' ADD'
END
IF ~(Additional_Help = '') THEN
DO
n=n+1
Command.n = assign' Locale: 'Additional_Help' ADD'
END
DO i=1 to n
r=SLine(Command.i)
END
r=Close(SSCRIPT)
CALL Do_and_Log
r=WriteLn(LOGFILE, 'Created StartupScript 'Init_File)
CALL LogLine
r=WLine('if exists 'Init_File)
r=WLine(' ask "
Remove
the Init-Script:
'Init_File'
? [y/n] "')
r=WLine(' if warn')
r=WLine(' delete 'Init_File)
r=WLine(' endif')
r=WLine('endif')
CALL SpaceNextEntry
RETURN
/* -------------- */
SLine:
PARSE ARG TheLine
r=WriteLn(SSCRIPT, TheLine)
RETURN 1
/* ----------------------------------------------- */
CopyHelp:
Msg="p_manuals"
Parameter1 = AppName
CALL ShowMessage
IF (Action=0) THEN CALL ExitMe
IF (Action=1) THEN
DO
InstName = ' Online Help '
SourceDir = RootPath'SYS/Inst_Help'
DestDir1 = 'SYS:'
DestDir1_Dir = 'SYS:'
CALL CopyAction
END
CALL SpaceNextEntry
RETURN
/* ------------ Rename .inf Icons to be viewn ----------- */
RenameIcons:
ADDRESS COMMAND
'echo >T:RenameInfos ";Rename .inf Files for 'InstModule'"'
list' >>T:RenameInfos /#?.inf LFORMAT "'rename RootPath'%n 'RootPath'%no*n MARInA_bin:IconPos >NIL: 'RootPath'%no type=PROJECT*nendif"'
execute' T:RenameInfos'
delete' T:RenameInfos quiet'
RETURN
/*-------------------------------------------------------*/
Create_UnInstallScript:
Msg = '_UnInstaller'
Parameter1 = AppName
CALL ShowMessage
UnInstDir = 'S:UnInstall'
UnInstScrName = InstModule'_ex'
IF ~EXISTS(UnInstDir) THEN ADDRESS COMMAND makedir UnInstDir
UnInstStarter='UnInst_'InstModule
ADDRESS COMMAND
'echo >SYS:Prefs/'UnInstStarter '"failat 30"'
'echo >>SYS:Prefs/'UnInstStarter '"stack 20000"'
'echo >>SYS:Prefs/'UnInstStarter '"copy 'UnInstDir'/'UnInstScrName'#? T: CLONE QUIET"'
'echo >>SYS:Prefs/'UnInstStarter '"run >NIL: execute T:'UnInstScrName'"'
IconPath=RootPath'SYS/Inst_SYS/Prefs'
Icon='UnInst_.info'
IF EXISTS(IconPath'/'Icon) THEN
ADDRESS COMMAND 'Install_C:rename' IconPath'/'Icon IconPath'/'UnInstStarter'.info'
TheFile = UnInstDir'/'UnInstScrName
IF ~Open(USCRIPT, TheFile, 'W') THEN Err_ShowMessage(TheFile)
r=WLine('failat 30')
r=WLine('cd T:')
r=WLine('newshell "CON:$SHELLSIZE/$SHELLTITLE/Close" from T:'UnInstScrName'.0')
CALL SpaceNextEntry
r=Close(USCRIPT)
/* ------------------- */
TheFile = UnInstDir'/'UnInstScrName'.0'
IF EXISTS(TheFile) THEN ADDRESS COMMAND delete' 'TheFile' QUIET'
IF ~Open(USCRIPT, TheFile, 'W') THEN Err_ShowMessage(TheFile)
r=WLine('failat 30')
r=WLine('cd T:')
r=WLine('echo "*ec*n*n"')
r=WLine('echo "
This is the UnInstall-Script for 'InstApp'.
"')
r=WLine('echo "*nIt will guide you by dialog through de-installation."')
r=WLine('echo "*nYou may always stop actions by pressing <Ctrl><c>"')
r=WLine('echo "and you may stop the whole script by pressing <Ctrl><d>"')
r=WLine('echo "*n[y/n] marks mean, that y[ENTER] = Yes n[]ENTER = No.*n"')
r=WLine('ask "Please press
ENTER
to continue [ok]"')
r=WLine('echo "*ec*n*n"')
RETURN
/* ------------------- */
Un_UnInstallScripts:
r=WLine('ask "
Remove
all
UnInstall-Scripts
now? [y/n] "')
r=WLine('if warn')
r=WLine(' delete 'UnInstDir'/'UnInstScrName'#?')
r=WLine(' delete T:'UnInstScrName'#? QUIET')
r=WLine('endif')
r=WLine('delete 'UnInstDir' QUIET')
CALL SpaceNextEntry
RETURN
/*---------------------*/
SpaceNextEntry:
r=WLine('wait 1')
r=WLine('echo "*ec*n*n"')
r=WLine(' ')
RETURN
/* -------------- */
WLine:
PARSE ARG TheLine
r=WriteLn(USCRIPT, TheLine)
RETURN 1
/*----------------------------------------------------------------*/
Do_and_Log:
r=WriteLn(LOGFILE, 'Executed Commands for 'InstName':')
r=WriteLn(LOGFILE, ' ')
DO i=1 to 100
IF(Command.i='COMMAND.'i) THEN LEAVE
TheCommand = LEFT(UPPER(Command.i),12)
IF (POS('ECHO', TheCommand)=0 & POS('FAILAT',TheCommand)=0 & POS('IF ',TheCommand)=0 & POS('ELSE',TheCommand)=0 & POS('ENDIF',TheCommand)=0 & POS('SKIP ',TheCommand)=0 & POS('QUIT',TheCommand)=0 & POS('ENDCLI',TheCommand)=0 ) THEN
DO
ADDRESS COMMAND Command.i
ResultCommand = RC
r=WriteLn(LOGFILE, Command.i)
Command.i = 'COMMAND.'i
END
END
CALL LogLine
RETURN
/*----------------------------------------------------------------*/
ShowMessage:
CALL ShowTheMessage
IF (Log_exists=1) THEN CALL LogLine
RETURN
/*-------------*/
ShowTheMessage:
drop Action
ReqType = ''
MsgFile = RootPath'Install-Guide/'Language'/'Msg
IF ~Open(fTmp, MsgFile, 'read') THEN Err_ShowMessage(MsgFile)
ELSE
DO
ReqType = ReadLn(fTmp) /* read Requester-Type */
Line = ReadLn(fTmp) /* read Title-Line */
CALL Substitutions
ReqTitle = Line
Line = ReadLn(fTmp) /* free line after Title */
Message = ""
DO UNTIL EOF(fTmp)
Line = ReadLn(fTmp)
CALL Substitutions
IF POS(">>>", Line) > 0 THEN
DO
rtBtns = STRIP(Line, 'L', '>')
LEAVE
END
ELSE
Message = Message || CR || Line
END
r=Close(fTmp)
END
IF (Log_exists = 1) THEN
DO
r=WriteLn(LOGFILE, Message)
r=WriteLn(LOGFILE, ' ')
r=WriteLn(LOGFILE, rtBtns)
r=WriteLn(LOGFILE, ' ')
END
IF (UPPER(ReqType) = 'MULTI REQUEST') THEN
DO
Action = rtezrequest(Message,rtBtns,ReqTitle,PosTags)
IF (Log_exists = 1) THEN r=WriteLn(LOGFILE, ' ----> Chosen Button-Nr.: 'Action)
RETURN
END
IF (UPPER(ReqType) = 'GETSTRING') THEN
DO
SelectedString = rtgetstring(PresetString,Message,ReqTitle,rtBtns,GStags,Action)
IF (Log_exists = 1) THEN r=WriteLn(LOGFILE, ' ----> Chosen String: 'SelectedString)
IF (Log_exists = 1) THEN r=WriteLn(LOGFILE, ' ----> Chosen Button-Nr.: 'Action)
RETURN
END
IF (UPPER(ReqType) = 'GET ONE FILE') THEN
DO
SelectedFile = rtfilerequest(ActualPath,ActualName,ReqTitle,rtBtns, ONEFILE_TAG, Files)
IF (Log_exists = 1) THEN r=WriteLn(LOGFILE, ' ----> Chosen File: 'SelectedFile)
RETURN
END
IF (UPPER(ReqType) = 'GETPATH') THEN
DO
SelectedPath = rtfilerequest(ActualPath,,ReqTitle,rtBtns, DIR_TAGS)
IF (Log_exists = 1) THEN r=WriteLn(LOGFILE, ' ----> Chosen Path: 'SelectedPath)
RETURN
END
IF (UPPER(ReqType) = 'GETFILES') THEN
DO
SelectedFiles = rtfilerequest(ActualPath,,ReqTitle,rtBtns, FILE_TAGS, Files)
IF (Log_exists = 1) THEN r=WriteLn(LOGFILE, ' ----> Chosen Files: 'SelectedFiles'...')
RETURN
END
Err_ShowMessage(MsgFile) /* Error if arrived here. Exit. */
RETURN
/*--------------------------------------------*/
Substitutions:
IF POS("%1", Line) > 0 THEN
DO UNTIL POS("%1", Line) = 0
parse var Line part1 '%1' part2
Line = part1''Parameter1''part2
END
IF POS("%2", Line) > 0 THEN
DO UNTIL POS("%2", Line) = 0
parse var Line part1 '%2' part2
Line = part1''Parameter2''part2
END
IF POS("%3", Line) > 0 THEN
DO UNTIL POS("%3", Line) = 0
parse var Line part1 '%3' part2
Line = part1''Parameter3''part2
END
IF POS("%4", Line) > 0 THEN
DO UNTIL POS("%4", Line) = 0
parse var Line part1 '%4' part2
Line = part1''Parameter4''part2
END
IF POS("%5", Line) > 0 THEN
DO UNTIL POS("%5", Line) = 0
parse var Line part1 '%5' part2
Line = part1''Parameter5''part2
END
IF POS("%6", Line) > 0 THEN
DO UNTIL POS("%6", Line) = 0
parse var Line part1 '%6' part2
Line = part1''Parameter6''part2
END
RETURN
/*--------------------------------------------*/
Err_ShowMessage:
PARSE ARG ErrFile
Message = AppName':' CR CR "Sorry, an error has occured accessing the File" CR CR " "ErrFile CR CR "... exiting."
rtBtns = 'Oh no!'
Action = rtezrequest(Message,rtBtns,ReqTitle,PosTags)
MustQuit=1
CALL ExitMe
/*-- Break if wrong Directory --------------------------------------- */
CheckInstallDir:
IF (~EXISTS(ObligedFile) | CurrentDir="NOTHING") THEN
DO
Msg="_StartAgain"
Parameter1 = AppName
Parameter2 = ObligedFile
CALL ShowMessage
MustQuit=1
CALL ExitMe
END
RETURN
/* ------------------------- */
RexxInstallInfo:
IF EXISTS('ENV:MsgFlag') THEN /* Rexx Info if needed */
DO
Msg='_Rexx_log'
Parameter1 = AppName
CALL ShowMessage
ADDRESS COMMAND
delete' ENV:MsgFlag QUIET'
END
RETURN
/* ------------------------- */
ExistsFile:
IF ~EXISTS(ObligedFile) THEN
DoesNotExist = 1
ELSE
DoesNotExist = 0
RETURN
/*----------------------------------------------------------------*/
MyGetENV: PROCEDURE
PARSE ARG name
TheFile = "ENV:" || name
IF (Open(fTmp, TheFile, 'read')) THEN
DO
ENVvalue = ReadLn(fTmp)
Closed = Close(fTmp)
END
ELSE
DO
ENVvalue = "NOTHING"
END
RETURN ENVvalue
/*-----------------------------------------------*/
CreateLogFile:
/* ---- Create MainLog (a AmigaGuide-file) */
MainLog = 'Help:'InstBase'_MainLog.log'
TempLog = 'T:'InstBase'_MainLog.log'
separator='____________________________________________________________________'
IF ~EXISTS(MainLog) THEN
DO
WasNoMainLog=1
IF ~Open(fTmp, TempLog, 'W') THEN Err_ShowMessage(TempLog)
r=WriteLn(fTmp, '@database "MARInA_Installer_Logfile"')
r=WriteLn(fTmp, " ")
r=WriteLn(fTmp, "@author MARInA-Installer, automatic generated file.")
r=WriteLn(fTmp, "@(c) Tom Neidhardt, 1998")
r=WriteLn(fTmp, "@$VER: MARInA-Installer 3.0")
r=WriteLn(fTmp, " ")
r=WriteLn(fTmp, "@font helvetica.font 13")
r=WriteLn(fTmp, "@wordwrap")
r=WriteLn(fTmp, " ")
r=WriteLn(fTmp, " ")
r=WriteLn(fTmp, '@Node Main "Installation Logbook MARInA-Installer, © 1998 by Tom Neidhardt"')
r=WriteLn(fTmp, " ")
r=WriteLn(fTmp, ' @{b}'InstBase' Installation logbook@{ub}')
r=WriteLn(fTmp, " ")
r=WriteLn(fTmp, " "Author)
r=WriteLn(fTmp, separator)
r=WriteLn(fTmp, " ")
r=Close(fTmp)
ADDRESS COMMAND
copy' "'TempLog'" "'MainLog'" CLONE QUIET'
delete' "'TempLog'" QUIET'
END
/* ---- Create SubLog, a simple ASCII-file, accessable by MainLog */
SubLog = 'HELP:'InstModule'_SubLog.log'
IF ~Open(LOGFILE, SubLog, 'W') THEN Err_ShowMessage(SubLog)
ADDRESS COMMAND 'Install_C:date >ENV:'ProcessNumber'_date'
TheDate = MyGetENV(ProcessNumber'_date')
Message = CR 'Protocol: 'AppName' 'TheDate
Message = Message || CR || separator || CR CR CR
r=WriteLn(LOGFILE, Message)
ADDRESS COMMAND delete' ENV:'ProcessNumber'_date QUIET'
Log_exists = 1
/* ---- Enhance a MainLog-Link for Sublog */
IF ~Open(MAINFILE, MainLog, 'R') THEN Err_ShowMessage(MainLog)
IF ~Open(fTmp, TempLog, 'W') THEN Err_ShowMessage(TempLog)
line=' '
LastEntry=0
NewEntry=1
FirstNewLine=' @{" " link 'SubLog'/main} Show the Install-Log for @{b}'InstModule'@{ub}'
DO UNTIL EOF(MAINFILE)
line=ReadLn(MAINFILE)
IF (line=FirstNewLine) THEN NewEntry=0
IF (LEFT(line,1)='.') THEN LastEntry=1
IF (LastEntry=0) THEN r=WriteLn(fTmp, line)
END
IF (NewEntry=1) THEN
DO
r=WriteLn(fTmp, ' ')
r=WriteLn(fTmp, FirstNewLine)
END
r=WriteLn(fTmp, '.')
r=WriteLn(fTmp, ' ')
r=WriteLn(fTmp, separator)
r=WriteLn(fTmp, '@ENDNODE')
r=Close(fTmp)
r=Close(MAINFILE)
ADDRESS COMMAND
copy' "'TempLog'" "'MainLog'" CLONE QUIET'
delete' "'TempLog'" QUIET'
RETURN
/* ----------- */
LogLine:
r=WriteLn(LOGFILE, ' ')
r=WriteLn(LOGFILE, '>>>----------------------------------------------------------------------------------')
RETURN
/*----------------------------------------------------------------*/
GetLanguage:
LanguageNumber = 1 /* Presets */
Language = ''
IF (open(TEMPFILE, 'ENV:sys/locale.prefs', 'read')) THEN
DO
DO i = 1 to 50
r = READCH(TEMPFILE)
END
Land = ''
i=0
DO UNTIL EOF(TEMPFILE)
i = i+1
Char = ReadCh(TEMPFILE)
IF (C2D(Char) = 0) THEN
LEAVE
ELSE
Land = Land''Char
END
/* 32 characters from begin of Lang_x to begin of Lang_y */
DO j = i to 31 UNTIL EOF(TEMPFILE) /* jump over next 20 chars */
r = READCH(TEMPFILE)
END
Language = ReadLanguage()
r = Close(TEMPFILE)
END
IF (Language='') THEN Language = 'english'
drop Char
drop r
RealLanguage=Language
ADDRESS COMMAND 'setenv LANGUAGE 'RealLanguage
IF ~EXISTS(Language'/_QuitInstall') THEN Language = 'english'
RETURN
RETURN
/*----------------------------------*/
ReadLanguage:
Langua = ''
Langua = ReadCh(TEMPFILE)
IF (C2D(Langua)=0) THEN RETURN ''
i=1
DO UNTIL EOF(TEMPFILE)
i=i+1
Char = ReadCh(TEMPFILE)
IF (C2D(Char)=0) THEN
LEAVE
ELSE
Langua = Langua''Char
END
/* 30 characters from begin of Lang_x to begin of Lang_y */
DO j = i to 29 UNTIL EOF(TEMPFILE)
r = READCH(TEMPFILE)
END
RETURN Langua
/*----------------------------------------------------------------*/
ExitMe:
r=PRAGMA('DIRECTORY', CurrentDir)
IF ~(Msg='_Intro1' | Msg='_Intro2') THEN
DO
IF(WasNoMainLog=1) THEN
DO
r=WLine('if exists 'MainLog)
r=WLine(' delete 'MainLog)
r=WLine('endif')
END
r=WLine('if exists 'SubLog)
r=WLine(' delete 'SubLog)
r=WLine('endif')
r=WLine(' ')
r=WLine('wait 1')
r=WLine('echo "*ec*n*n 'InstApp' De-Installation
completed
.*n*n
Exiting in 5 secs.
"')
r=WLine('wait 5')
r=WLine('endcli')
END
IF (DestFull = 1) THEN
DO
Msg = '_CopyProtected'
Parameter1 = AppName
Parameter2 = ActualFile
Parameter3 = '10'
Parameter4 = Target
CALL ShowMessage
END
IF ~(MustQuit = 1 | DestFull = 1) THEN
DO
Msg = '_QuitInstall'
Parameter1 = AppName
CALL ShowMessage
IF (Action = 0) THEN RETURN
END
r=Close(fTmp)
r=Close(USCRIPT)
r=Close(SSCRIPT)
r=Close(LOGFILE)
ADDRESS COMMAND RootPath'Install-Guide/c/assign Install_C: REMOVE'
ViewPort='INST_'UPPER(InstModule)
IF SHOW('P',ViewPort) THEN /* Open the App's Guide */
DO
ModuleGuide='HELP:'Language'/'InstModule'.guide'
IF EXISTS(ModuleGuide) THEN
DO
ADDRESS VALUE ViewPort
'OPEN NAME' ModuleGuide
END
ADDRESS COMMAND
RootPath'SYS/Choice_MARInA_bin/SWindow >NIL: "'InstModule', ©#?" p p 594 m'
RootPath'SYS/Choice_MARInA_bin/SWindow >NIL: "'InstModule', ©#?" f'
ADDRESS VALUE ViewPort 'RELOAD'
END
EXIT 0